public class FlightTicket {
    public static void main(String[] args) {
        double price = calculate(1000, 11, "头等舱");
        System.out.println("优惠价是：" + price);
    }

    public static double calculate(double originalPrice, int month, String cabinClass) {
        double discountRate;
        
        // 判断月份是旺季还是淡季
        if (month >= 5 && month <= 10) {
            // 旺季
            if (cabinClass.equals("头等舱")) {
                discountRate = 0.9; // 头等舱9折
            } else {
                discountRate = 0.85; // 经济舱8.5折
            }
        } else {
            // 淡季
            if (cabinClass.equals("头等舱")) {
                discountRate = 0.7; // 头等舱7折
            } else {
                discountRate = 0.65; // 经济舱6.5折
            }
        }
        
        return originalPrice * discountRate;
    }
}
